Skip to content

fix: add path traversal guard in sync_marketplace_to_plugins.py#170

Open
xiaolai wants to merge 2 commits into
fcakyon:mainfrom
xiaolai:fix/nlpm-path-traversal-guard
Open

fix: add path traversal guard in sync_marketplace_to_plugins.py#170
xiaolai wants to merge 2 commits into
fcakyon:mainfrom
xiaolai:fix/nlpm-path-traversal-guard

Conversation

@xiaolai
Copy link
Copy Markdown
Contributor

@xiaolai xiaolai commented Apr 22, 2026

Automated audit: This PR was generated by NLPM, a natural language programming linter, running via claude-code-action. Please evaluate the diff on its merits.

The sync_marketplace_to_plugins.py hook script resolves the source field from marketplace.json into a file path but does not verify that the resolved path stays within the expected plugin root. A tampered marketplace.json could write files outside the repository. This PR adds a guard that skips any entry whose resolved path escapes the marketplace root.

  • Added a check after plugin_dir = (marketplace_dir / source).resolve() that compares the resolved path against the marketplace root
  • If the resolved path escapes the root, the entry is skipped with a warning to stderr and the loop continues

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants